package com.platform.module.common.enums.app;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Long
 **/
public enum AppNameEnum {

    // 新定义包名
    H5_NEW_WINNER("H5_IN_WINNER", "com.winner.app", "", "in-winner"),
    // 第二个包
    H5_SAG_WINNER("H5_SAG_WINNER", "com.sag.app", "", "sag-winner"),
    // 新增包名 BW
    H5_BET_WIN("H5_BET_WIN", "com.betwin.app", "", "bet-win"),

    NONE("NONE", "none", "", "none");

    private static final Logger log = LoggerFactory.getLogger(AppNameEnum.class);
    private final String name;
    private final String desc;
    // 估计是用于 AppsFlyer 的 key
    private final String afKey;
    private final String appId;

    AppNameEnum(String name, String desc, String afKey, String appId) {
        this.name = name;
        this.desc = desc;
        this.afKey = afKey;
        this.appId = appId;
    }

    public String getName() {
        return this.name;
    }

    public String getDesc() {
        return this.desc;
    }

    public String getAfKey() {
        return this.afKey;
    }

    public String getAppId() {
        return this.appId;
    }


    public static AppNameEnum valueOfAppName(String name) {
        if (StringUtils.isBlank(name)) {
            log.warn("appName is null");
        }
        for (AppNameEnum appNameEnum : values()) {
            if (appNameEnum.name.equals(name)) {
                return appNameEnum;
            }
        }
        log.error("appName is error appName={}", name);
        return null;
    }

}
